<?php
if(isset($_SESSION['roles']) && isset($_SESSION['sess_login_username'])){
    if( ($_SESSION['sess_login_username']!='') && ($_SESSION['roles']!='')){

    }
    else
        header('Location: index.php');

}
else
        header('Location: index.php');
require('./roots.php');

require_once('./classes/rbac.php');

include('languaje/'.$_SESSION['lang'].'/lang_'.$_SESSION['lang'].'_rbac.php');

include "header.php";

$action='UsuarioBuscar.php';


if (isset($_POST['login'])){
    $rbac= new rbac();
    $gui1=$rbac->Buscar_usuario($_POST['login'],$_SESSION['sess_login_username']);

if($gui1==FALSE)
    $Message=$LDNoPermiso;
else if ($gui1==NULL)
    $Message=$LDBusqRecurError;
else
    $gui=$gui1;
}

?>

 <form method="post" action="<?php echo $action; ?>" name="regform" ENCTYPE="multipart/form-data" onSubmit="return chkform(this)"> 


	<div id="page">
	<div id="page-bgtop">
	<div id="page-bgbtm">
		<div id="content">
			<div class="post">
			<div class="post-bgtop">
			<div class="post-bgbtm">
				<h2 class="title"><a href="#"><?php echo $LDBuscarUsuario; ?></a></h2>
				<div class="entry">
					<p>
					<?php echo $Message; ?>
					<div class="table">
                                                <table width=100%>
							<tr>
								<td >
									<?php echo $LDUsuario; ?>:
								</td>
								</tr>
                                                        <tr>
								<td >
									<input type="text" name="login" value=""/>
								</td>
							</tr>
						</table>
                                   	</div>
						<div id="botones">
							<h1><a href="#" onclick="document.forms[0].submit()"><?php echo $LDBuscar; ?></a></h1>
						</div>
					</p>
				</div>
                                <br>
                                <br>
                                  <?php if($gui !=NULL){ ?>
                                        <h2 class="title">
						<table width=100%>
							<tr>
								<td width=50%>
									<a href="#"><?php echo $LDNombre; ?></a>
								</td>
								<td width=50%>
									<a href="#"><?php echo $LDEstado; ?></a>
								</td>
							</tr>
						</table>
					</h2>
					<?php
                                        if ($gui)
					foreach($gui as $array=>$name){
					?>
					<div class="table">
                                                <table width=100%>
							<tr>
								<td width=50%>
									<?php echo $name['login']; ?>
								</td>
								<td width=50%>
									<?php 									
									if($name['status']==1){
										echo $LDActivo;
									}else{
										echo $LDInactivo;
									}
									?>
								</td>
							</tr>
						</table>
                                   	</div>
				<?php } }?>
			</div>
			</div>
			</div>
			
		<div style="clear: both;">&nbsp;</div>
		</div>

		<div id="sidebar">
				<ul>
					<li>
						<h2><?php echo $LDCategorias; ?></h2>
						<?php

						include "MenuRbac.php";

						?>
						<script type="text/javascript">

						cssdropdown.startchrome("chromemenu")

						</script>
				</li>
			</ul>
		</div>

		<div style="clear: both;">&nbsp;</div>
	</div>
	</div>
	</div>
</div>

</form>
<?php

include "footer.php";

?>
